export interface ResponseData<T = Record<string, any>, C = false> {
	code : number,
	total ?: number,
	data : C extends true ? undefined : T,
	rows : C extends true ? T : undefined,
	msg : string
	ok ?: boolean
}
export interface IMResponseData<T = Record<string, any>, C = false> {
	data : C extends true ? undefined : T,
	msg : string
	ok : boolean
}

export interface PagingData<T = Record<string, any>> {
	total : number,
	rows : T[]
}

export interface ResponseRowsRes<T = Record<string, any>> extends ResponseData<PagingData<T>> {

}
export interface Config {
	baseUrl : string,
	header : {
		'Content-Type' : string
		'Authorization' ?: string
	},
	method : 'GET' | 'POST' | 'PUT' | "DELETE",
	dataType : 'json'
}
export interface RequestConfig extends Config {
	url : string,
	data : Record<string, any>
	params : Record<string, any>
}
export interface pageParam extends Record<string, any> {
	pageNum : number,
	pageSize : number,
}

export interface RequestOptionCustom {
	auth ?: boolean//必须登录 默认为true
	isLoading ?: boolean//显示loading
	showMsg ?: boolean//显示接口返回的msg
	parseJson ?: boolean//接口的data字段是json，自动解析该json，返回解析后的对象而非json字符串
	goLogin ?: boolean//auth不为false的情况下，token过期或未登录时，是否跳转至登录页面 默认为false
	isLocation ?: boolean//请求头携带经纬度
	getError ?: boolean //接口报错时，自定义处理逻辑，此时接口不会是reject状态
	filter?: boolean //过滤接口参数内的null、undefined、空对象与空数组，默认为true
}

export type RequestFromType = 'mp' | 'app' | 'H5' | 'miniapp' | 'mp_private'